Walling towns is an old practice.
The oldest known one is ancient Jerico form 9400 BCE, which had walls over 3.6 meters high and half as wide at the base.
Another famous example is ancient Constantinople, whose Theodosian walls were 12 meters high and 4.5 - 6 meters thick, studded with towers and protected by a second lower outer wall.
They were defeated only twice, the first time by the infamous Fourth Crusade in 1204 CE
and the second time by Turkish bombards in 1453 CE.
War Matrix - Walled town
Prehistory 35000 BCE - 3500 BCE, Weapons and technology